<template>
  <div style="background-color: #f5f6fa">
    <!-- <hear></hear> -->
    <BDhear :num="6"></BDhear>

    <div class="agreements">
      <div style="width: 100%; display: flex; justify-content: flex-end">
        <el-button
          @click="yijina"
          style="
            background: #1795ff;
            padding: 10px;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #fff;
          "
        >
          <img
            src="@/assets/ico/xin (9).png"
            style="width: 22px"
            alt=""
            srcset=""
          />
          一键签订</el-button
        >
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ frqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;法人证明书 &nbsp;</div>
            <div class="zhengch" v-if="faren == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="faren=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="farenqianzhang1('法人证明书')"
            style="width: 82px; height: 34px"
            >{{ faren }}</el-button
          >
        </div>
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ bhqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;保函签章&nbsp;</div>
            <div class="zhengch" v-if="bh == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="bhzongqz('法人身份证')"
            style="width: 82px; height: 34px"
            >{{ bh }}</el-button
          >
        </div>
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ zsqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;真实性承诺书&nbsp;</div>
            <div class="zhengch" v-if="zhenshi == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="zszongqz('真实性承诺书')"
            style="width: 82px; height: 34px"
            >{{ zhenshi }}</el-button
          >
        </div>
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ sfzqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;法人身份证&nbsp;</div>
            <div class="zhengch" v-if="sfz == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="sfzzongqz('法人身份证')"
            style="width: 82px; height: 34px"
            >{{ sfz }}</el-button
          >
        </div>
      </div>

      <div v-if="false" class="EP_pdf_box">
        <div class="leixingcss">{{ bhqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;法人身份证&nbsp;</div>
            <div class="zhengch" v-if="bh == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="bhzongqz('法人身份证')"
            style="width: 82px; height: 34px"
            >{{ bh }}</el-button
          >
        </div>
      </div>

      <div class="EP_pdf_box">
        <div class="leixingcss">{{ yyqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>营业执照副本&nbsp;</div>
            <div class="zhengch" v-if="zhizhao == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="zhizongqz('营业执照副本')"
            style="width: 82px; height: 34px"
            >{{ zhizhao }}</el-button
          >
        </div>
      </div>
      <!-- <div class="EP_pdf_box">
        <div class="leixingcss">{{ htqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;保函合同&nbsp;</div>
            <div class="zhengch" v-if="hetong == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div>
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="htzongqz('保函合同')"
            style="width: 82px; height: 34px"
            >{{ hetong }}</el-button
          >
        </div>
      </div> -->
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ xyqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;担保协议&nbsp;</div>
            <div class="zhengch" v-if="xyangc == '等待审核'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="danbaoqianzhang('公司章程')"
            style="width: 82px; height: 34px"
            >{{ xyangc }}</el-button
          >
        </div>
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ khqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;开户许可证&nbsp;</div>
            <div class="zhengch" v-if="kaihu == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="khzongqz('开户许可证')"
            style="width: 82px; height: 34px"
            >{{ kaihu }}</el-button
          >
        </div>
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ zcqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;公司章程&nbsp;</div>
            <div class="zhengch" v-if="zhangc == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="zczongqz('公司章程')"
            style="width: 82px; height: 34px"
            >{{ zhangc }}</el-button
          >
        </div>
      </div>
      <div class="EP_pdf_box">
        <div class="leixingcss">{{ sjqian }}</div>
        <div class="EP_PDF_IMG_LEFT">
          <div class="EP_img">
            <img src="../../assets/BidSecurity/EP_PDF.png" />
          </div>
          <div class="zhengc">
            <div>&nbsp;近一年审计报告&nbsp;</div>
            <div class="zhengch" v-if="shenj == '查看'">
              <div>&nbsp;签订人：{{ farens }}&nbsp;</div>
              <div>&nbsp;签订公司：{{ gongsi }}&nbsp;</div>
            </div>
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订人：{{farens}}&nbsp;</div>
            <div v-if="zhenshi=='查看'">&nbsp;签订公司：{{gongsi}}&nbsp;</div> -->
            <!-- <div v-if="zhenshi=='查看'">&nbsp;签订时间：2022-08-18 17:51:43</div> -->
          </div>
        </div>
        <div class="EP_PDF_RIGHT">
          <el-button style="height: 34px">查看模板</el-button>
          <el-button
            @click="sjzongqz('近一年审计报告')"
            style="width: 82px; height: 34px"
            >{{ shenj }}</el-button
          >
        </div>
      </div>
    </div>
    <div class="footer">
      <el-button
        @click="shang()"
        v-if="isShow"
        style="width: 175px; height: 60px"
        >上一步</el-button
      >
      <el-button
        v-if="isShow"
        @click="tiao()"
        style="width: 175px; height: 60px"
        type="primary"
        >提交审核</el-button
      >
      <el-button
        v-if="!isShow"
        @click="$router.push('/')"
        style="width: 175px; height: 60px"
        type="primary"
        >回到首页</el-button
      >
      <el-button
        v-if="isShow1"
        style="width: 175px; height: 60px"
        type="info"
        disabled
        >审核中</el-button
      >
      <el-button
        v-if="isShow2"
        @click="$router.push('/Bidpayments')"
        style="width: 175px; height: 60px"
        type="primary"
        disabled=""
        >审核已完成，去支付</el-button
      >
      <!-- <el-button  @click="$router.push('/')"  type="info" disabled="">审核中  </el-button> -->
      <!-- <el-button  @click="$router.push('/')"  type="info" disabled="">审核中  </el-button> -->
    </div>
  </div>
</template>

<script>
// import hear from ".././../components/hear.vue";
import {
  bhpay2,
  danbaoqianzhang,
  bhpay,
  bhpay3,
  enclosure,
  zhifuasd,
  faren,
  detail,
} from "@/api/system/liucheng";
import {
  qianzhang,
  wenjian,
  scqianzhang,
  baohanqianzhang,
} from "@/api/system/liucheng";
import BDhear from "./BDhear.vue";
import axios from "axios";

export default {
  components: {
    BDhear,
    // hear,
  },
  name: "ElectronicProtocol",
  data() {
    return {
      isShow: true,
      isShow1: false,
      isShow2: false,
      isShow3: false,
      asdtou: true,
      // 按钮
      bhqian: "未签订", //保函签章
      bhqianurl: "未签订", //保函签章
      bh: "签订", //保函签章
      faren: "签订", //法人证明书

      zhenshi: "签订", //真实性承诺书
      sfz: "签订", //法人身份证
      zhizhao: "签订", //营业执照副本
      hetong: "签订", //保函合同
      kaihu: "签订", //开户许可证
      zhangc: "签订", //公司章程
      shenj: "签订", //近一年审计报告
      bh: "签订", //保函签章
      //  右上
      frqian: "未签订", //法人证明书
      dbqian: "未签订", //反担保协议书
      zsqian: "未签订", //真实性承诺书
      sfzqian: "未签订", //法人身份证
      bhqian: "未签订", //保函签章
      yyqian: "未签订", //营业执照副本
      htqian: "未签订", //保函合同
      khqian: "未签订", //开户许可证
      zcqian: "未签订", //公司章程
      sjqian: "未签订", //近一年审计报告
      xyqian: "未签订", //担保协议
      xyangc: "签订", //担保协议
      farenurl: "",
      danbaourl: "",
      zhenshiurl: "",
      yingye: "签订",
      farensfz: "签订",
      // 文件预览
      //  右上
      frqianurl: "未签订", //法人证明书
      dbqianurl: "未签订", //反担保协议书
      zsqianurl: "未签订", //真实性承诺书
      sfzqianurl: "未签订", //法人身份证
      bhqianurl: "未签订", //保函签章
      yyqianurl: "未签订", //营业执照副本
      htqianurl: "未签订", //保函合同
      khqianurl: "未签订", //开户许可证
      zcqianurl: "未签订", //公司章程
      sjqianurl: "未签订", //近一年审计报告
      ElectronicProtocollist: { guarantee_apply_id: "549" },
      formData: {
        apply_number: sessionStorage.getItem("apply_number"),
        guarantee_apply_id: sessionStorage.getItem("guarantee_apply_id"),
        diya: null,
        chuzhi: null,
        fandanbao: null,
        // handler_name_one: undefined,
        // cardno_one: undefined,
        // captcha_one:"",
        // proid: undefined,
        // handler_mobile_one: undefined,
        // handler_name_one: "王治家",
        // cardno_one: "410381198711235517",
        // captcha_one: "123456",
        proid: undefined,
        // handler_mobile_one: "13681030210"
      },
      ciasd: true,
      rules: {
        diya: [
          {
            required: true,
            message: "请输入抵押人：",
            trigger: "blur",
          },
        ],
        chuzhi: [
          {
            required: true,
            message: "请输入出质人：",
            trigger: "blur",
          },
        ],
        fandanbao: [
          {
            required: true,
            message: "请输入反担保人：",
            trigger: "blur",
          },
        ],
        handler_name_one: [
          {
            required: true,
            message: "请输入反担保人姓名：",
            trigger: "blur",
          },
        ],
        handler_mobile_one: [
          {
            required: true,
            message: "请输入联系电话：",
            trigger: "blur",
          },
        ],
        cardno_one: [
          {
            required: true,
            message: "请输入身份证号码：",
            trigger: "blur",
          },
        ],
        field139: [
          {
            required: true,
            message: "请输入验证码：",
            trigger: "blur",
          },
        ],
      },
      xinxi: {},
      farens: "", //签订人
      gongsi: "", //签订公司
      wenjian: {},
    };
  },
  created() {
    // this.ElectronicProtocols();
    this.xinagqing();
    // this.wenjians();
    this.wenjianssss();
    var leixng = sessionStorage.getItem("bhlein");
    if (leixng == "投标保函") {
      this.ciasd = false;
      this.asdtou = false;
    }
    // datatijiao(this.params).then(res => {
    //   if (res.data.code == 1) {
    //     this.$message.success('提交成')
    //     this.$router.push("/bidFrom");
    //   }
    // });
  },
  methods: {
    yijina() {
      console.log("一键签订");
      this.farenqianzhang1("法人证明书");
      this.zszongqz("真实性承诺书");
      this.sfzzongqz("法人身份证");
      this.bhzzongqz();
      this.zhizongqz("营业执照副本");
      this.khzongqz("开户许可证");
      this.zczongqz("公司章程");
      this.sjzongqz("近一年审计报告");
      this.danbaoqianzhang();
      this.bhzongqz();
    },
    bhzongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
      };
      console.log(this.$baseUrl);
      if (this.bh == "查看") {
        return this.yulan(this.bhqianurl);
      }
      if (this.bh == "签订") {
        this.bh = "签订中";
        this.bhzqian = "正在签订";
        // bhpay3
        baohanqianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.bhqianurl = res.data.data;
            this.bh = "查看";
            this.bhqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.bhqian = "未签订";
            this.bh = "签订";
          }
        });
      }
      if (this.bh == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    danbaoqianzhang() {
      if (this.xyangc == "等待审核") {
        return;
        this.yulan(this.xieyiurl);
      }
      if (this.xyangc == "签订") {
        this.xyangc = "签订中";
        this.xyqian = "正在签订";
        danbaoqianzhang({
          apply_number: sessionStorage.getItem("apply_number"),
        }).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.xieyiurl = res.data.data;
            this.xyangc = "等待审核";
            this.xyqian = "已签订";
          } else {
            this.xyangc = "签订";
          }
        });
      }
      if (this.xyangc == "签订中") {
        // this.$message({
        //   showClose: true,
        //   message: "签订中...",
        //   type: "warning",
        // });
      }
    },
    qianzhangs(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      qianzhang(bbc).then((res) => {
        if (res.data.code == 1) {
          this.$message.success("提交成");
          this.$router.push("/bidFrom");
        }
      });
    },
    // 文件
    wenjians() {
      wenjian().then((res) => {
        if (res.data.code == 1) {
          this.wenjian = res.data.data;
          console.log("文件", res.data.data);
        }
      });
    },
    wenjianssss() {
      console.log("gongsi");
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
      };
      enclosure(bbc).then((res) => {
        console.log("gongsi", res.data.data);
        this.xinxi = res.data.data;
        this.farens = res.data.data.faren;
        this.gongsi = res.data.data.gongsi;
        if (res.data.data.file == null) {
          return;
        }

        if (res.data.data.file.faren_file !== null) {
          this.farenurl = res.data.data.file.faren_file;
          this.faren = "查看";
          this.frqian = "已签订";
        }
        if (res.data.data.file.xieyi_file !== null) {
          this.danbaourl = res.data.data.file.xieyi_file;
          this.danbao = "查看";
          this.dbqian = "已签订";
        }
        if (res.data.data.file.zhenshi_file !== null) {
          this.zhenshiurl = res.data.data.file.zhenshi_file;
          this.zhenshi = "查看";
          this.zsqian = "已签订";
        }
      });
    },
    //页面
    xinagqing() {
      var bbc = {
        bh_id: sessionStorage.getItem("guarantee_apply_id"),
      };
      detail(bbc).then((res) => {
        console.log("保函详情", res.data.data.jiben);
        console.log("审核状态", res.data.data.jiben.state);
        console.log("进度", res.data.data.jiben.step);
        console.log("审核人员", res.data.data.jiben.check_id);
        var shenhe = res.data.data.jiben.state;
        var jindu = res.data.data.jiben.step;
        var renyaun = res.data.data.jiben.check_id;
        // 测试
        //  this.isShow2=true

        if (shenhe == 0 && jindu == 1 && renyaun == null) {
          console.log("未提交");
        } else {
          this.isShow = false;
        }
        if (shenhe == 1 && jindu == 2 && renyaun == null) {
          console.log("第一次提交审核");
          this.isShow1 = true;
        }
        if (shenhe == 1 && jindu == 2 && renyaun !== null) {
          console.log("第一次已分配");
          this.isShow1 = true;
        }
        if (shenhe == 2 && (jindu == 3) & (renyaun !== null)) {
          console.log("第一次审核完成");
          this.isShow2 = true;
        }
        if (shenhe == 1 && (jindu == 4) & (renyaun !== null)) {
          console.log("第二次提交审核");
        }
        if (shenhe == 2 && (jindu == 3) & (renyaun !== null)) {
          console.log("第二次审核完成");
        }
        // 审核状态 state
        // 进度  step
        // 审核人员  check_id

        if (res.data.code == 1) {
          // this.$message.success("签订成功");
        }
      });
    },
    sfzzongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      console.log(this.$baseUrl);
      if (this.sfz == "查看") {
        return this.yulan(this.sfzqianurl);
      }
      if (this.sfz == "签订") {
        this.sfz = "签订中";
        this.sfzqian = "正在签订";
        // bhpay3
        qianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.sfzqianurl = res.data.data;
            this.sfz = "查看";
            this.sfzqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.sfzqian = "未签订";
            this.sfz = "签订";
          }
        });
      }
      if (this.sfz == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    bhzongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
      };
      console.log(this.$baseUrl);
      if (this.bh == "查看") {
        return this.yulan(this.sfzqianurl);
      }
      if (this.bh == "签订") {
        this.bh = "签订中";
        this.bhzqian = "正在签订";
        // bhpay3
        baohanqianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.bhqianurl = res.data.data;
            this.bh = "查看";
            this.bhqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.bhqian = "未签订";
            this.bh = "签订";
          }
        });
      }
      if (this.bh == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    zszongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
        file: sessionStorage.getItem("zsxcns"),
      };
      if (this.zhenshi == "查看") {
        this.yulan(this.zsqianurl);
        return;
      }
      console.log(this.$baseUrl);
      if (this.zhenshi == "签订") {
        this.zhenshi = "签订中";
        this.zsqian = "正在签订";
        // bhpay3
        scqianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.zsqianurl = res.data.data;
            this.zhenshi = "查看";
            this.zsqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.zsqian = "未签订";
            this.zhenshi = "签订";
          }
        });
      }
      if (this.faren == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    zhizongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      if (this.zhizhao == "查看") {
        this.yulan(this.yyqianurl);
        return;
      }
      console.log(this.$baseUrl);
      if (this.zhizhao == "签订") {
        this.zhizhao = "签订中";
        this.yyqian = "正在签订";
        // bhpay3
        qianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.yyqianurl = res.data.data;
            this.zhizhao = "查看";
            this.yyqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.yyqian = "未签订";
            this.zhizhao = "签订";
          }
        });
      }
      if (this.faren == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    htzongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      if (this.faren == "查看") {
        this.yulan(this.htqianurl);
        return;
      }
      console.log(this.$baseUrl);
      if (this.hetong == "签订") {
        this.hetong = "签订中";
        this.htqian = "正在签订";
        // bhpay3
        qianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.htqianurl = res.data.data;
            this.hetong = "查看";
            this.frqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.htqian = "未签订";
            this.hetong = "签订";
          }
        });
      }
      if (this.faren == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    khzongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      if (this.kaihu == "查看") {
        this.yulan(this.khqianurl);
        return;
      }
      console.log(this.$baseUrl);
      if (this.kaihu == "签订") {
        this.kaihu = "签订中";
        this.khqian = "正在签订";
        // bhpay3
        qianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.khqianurl = res.data.data;
            this.kaihu = "查看";
            this.khqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.khqian = "未签订";
            this.kaihu = "签订";
          }
        });
      }
      if (this.kaihu == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    zczongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      if (this.zhangc == "查看") {
        return this.yulan(this.zcqianurl);
      }
      console.log(this.$baseUrl);
      if (this.zhangc == "签订") {
        this.zhangc = "签订中";
        this.zcqian = "正在签订";
        // bhpay3
        qianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.zcqianurl = res.data.data;
            this.zhangc = "查看";
            this.zcqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.zcqian = "未签订";
            this.zhangc = "签订";
          }
        });
      }
      if (this.zhangc == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    sjzongqz(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
        file: sessionStorage.getItem("sjbg"),
      };
      if (this.shenj == "查看") {
        return this.yulan(this.sjqianurl);
      }
      console.log(this.$baseUrl);
      if (this.shenj == "签订") {
        this.shenj = "签订中";
        this.sjqian = "正在签订";
        // bhpay3
        scqianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.sjqianurl = res.data.data;
            this.shenj = "查看";
            this.sjqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.sjqian = "未签订";
            this.shenj = "签订";
          }
        });
      }
      if (this.shenj == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    danbaoqianzhang1() {
      if (this.danbao == "查看") {
        return this.yulan(this.danbaourl);
      }
      if (this.danbao == "签订") {
        this.danbao = "签订中";
        this.frqian = "正在签订";
        bhpay(this.formData).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.danbaourl = res.data.data;
            this.danbao = "查看";
            this.dbqian = "已签订";
          } else {
            this.danbao = "签订";
          }
        });
      }
      if (this.danbao == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    farenqianzhang1(e) {
      var bbc = {
        apply_number: sessionStorage.getItem("apply_number"),
        name: e,
      };
      if (this.faren == "查看") {
        return this.yulan(this.farenurl);
      }
      console.log(this.$baseUrl);
      if (this.faren == "签订") {
        this.faren = "签订中";
        this.frqian = "正在签订";
        // bhpay3
        qianzhang(bbc).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.farenurl = res.data.data;
            this.faren = "查看";
            this.frqian = "已签订";
          } else {
            this.$message({
              showClose: true,
              message: res.data.msg,
              type: "error",
            });
            this.frqian = "未签订";
            this.faren = "签订";
          }
        });
      }
      if (this.faren == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    yulan(e) {
      this.$confirmMy({
        title: e,
      });
      return;
      let link = document.createElement("a");
      link.style.display = "none";
      link.style.download = "";
      link.target = "_blank";
      link.href = this.$baseUrl + e + "";
      // link.setAttribute("download", ".pdf");
      // +'.pdf' 通过不同的后缀名下载不同的文件
      //这里下载的是pdf格式的文件，拿到接口里的res也必须是pdf的文件流
      // document.body.appendChild(link);
      link.click();
      URL.revokeObjectURL(link.href); //URL.revokeObjectURL() 静态方法用来释放一个之前通过调用 URL.createObjectURL() 创建的已经存在的 URL 对象。当你结束使用某个 URL 对象时，应该通过调用这个方法来让浏览器知道不再需要保持这个文件的引用了。
      document.body.removeChild(link);
    },
    zhenshiqianzhang1() {
      if (this.zhenshi == "查看") {
        return this.yulan(this.zhenshiurl);
      }
      if (this.zhenshi == "签订") {
        this.zhenshi = "签订中";
        this.zsqian = "正在签订";
        bhpay2(this.formData).then((res) => {
          if (res.data.code == 1) {
            this.$message.success(res.data.msg);
            this.zhenshiurl = res.data.data;
            this.zhenshi = "查看";
            this.zsqian = "已签订";
          } else {
            this.zhenshi = "签订";
          }
        });
      }
      if (this.zhenshi == "签订中") {
        this.$message({
          showClose: true,
          message: "签订中...",
          type: "warning",
        });
      }
    },
    send() {
      axios({
        url: "http://192.168.0.28:8082/mobile/sms/send",
        method: "post", // params: '必须是一个无格式对象 query参数',
        data: {
          mobile: this.formData.handler_mobile_one,
          event: "check",
        },
        timeout: 1000,
        headers: {
          token: sessionStorage.getItem("token"),
        },
      });
    },
    wancheng() {
      this.$message.error("请勿重复提交");
    },
    guarantee() {
      guarantee(this.formData).then(() => {});
    },
    shang() {
      if (sessionStorage.getItem("bhlein") == "投标保函") {
        this.$router.push("/BidSecurity/bidFroms");
      } else {
        this.$router.push("/BidSecurity/ElectronicProtocol");
      }
    },
    tiao() {
      // return
      if (false) {
        axios({
          url: "http://192.168.0.28:8082/handle/baohan/guarantee_add",
          method: "post", // params: '必须是一个无格式对象 query参数',
          data: {
            handler_name_one: this.formData.handler_name_one,
            handler_mobile_one: this.formData.handler_mobile_one,
            cardno_one: this.formData.cardno_one,
            captcha_one: this.formData.captcha_one,
            proid: sessionStorage.getItem("proid"),
            apply_number: sessionStorage.getItem("apply_number"),
          },
          timeout: 10000,
          headers: {
            token: sessionStorage.getItem("token"),
          },
        })
          .then((res) => {
            //    this.$notify.error({
            //   message: res.data.msg
            // });
            console.log("tijiao", res);
            if (res.data.code == 1) {
              this.$message.success(res.data.msg);
              // this.isShow = false;
            }
            // this.$router.push("/BidSecurity/Bidpayment");
          })
          .catch((err) => {
            console.log("失败", err);
            if (err.response.data.code == 401) {
              this.$notify.error({
                message: "请重新登录",
              });
              this.$router.push("/login");
              return;
            }
            this.$notify.error({
              message: err.response.data.msg,
            });
          });
      }
      // return
      axios({
        url: "http://192.168.0.28:8082/handle/baohan/subdata",
        method: "post", // params: '必须是一个无格式对象 query参数',
        data: {
          apply_number: sessionStorage.getItem("apply_number"),
        },
        timeout: 10000,
        headers: {
          token: sessionStorage.getItem("token"),
        },
      })
        .then((res) => {
          //    this.$notify.error({
          //   message: res.data.msg
          // });
          console.log("tijiao", res);
          if (res.data.code == 1) {
            this.$message.success("提交成功等待审核");
            this.isShow = false;
          }
          //  this.$router.push("/BidSecurity/BidPayment");
          // this.$router.push("/BidSecurity/Bidpayment");
        })
        .catch((err) => {
          console.log("失败", err);
          if (err.response.data.code == 401) {
            this.$notify.error({
              message: "请重新登录",
            });
            this.$router.push("/login");
            return;
          }
          this.$notify.error({
            message: err.response.data.msg,
          });
        });
    },
  },
};
</script>

<style scoped>
.zhengc {
  font-size: 16px;
  color: rgb(51, 51, 51);
  flex: 1;
  flex-direction: column;
  display: flex;
}
.zhengch {
  display: flex;
  margin-top: 5px;
}
.el-upload__tip {
  line-height: 1.2;
}
.main {
  /* position: absolute;
  top: 0;
  left: 0;
  bottom: 160px;
  right: 0; */
  padding: 0 11%;
  margin: auto;
  width: 100%;
  height: 360px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.main .yes {
  background: #fff;
  width: 100%;
  height: 360px;
  border: #cecece 1px solid;
}
.main h3 {
  margin: 20px;
}
.main .yesform {
  width: 100%;
  height: 260px;
  /* margin: 50px; */
}
.main .no {
  width: 49%;
  height: 360px;
  border: #cecece 1px solid;
}
.main .noform {
  width: 100%;
  height: 260px;
  /* margin: 50px; */
}
.main .noform button {
  width: 50%;
  height: 38px;
  background-color: #1795ff;
  color: #fff;
  border: none;
  position: absolute;
  border-radius: 5px;
  margin-left: 5px;
  margin-bottom: 1px;
}
.agreement {
  /* position: absolute;
  top: 63%;
  left: 10.7%; */
  padding: 5% 11%;
  width: 100%;
  height: 200px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.agreements {
  /* position: absolute;
  top: 63%;
  left: 10.7%; */
  /* padding: 5% 11%; */
  padding: 10px;
  padding-top: 0px;
  margin: 0 7.5%;
  width: 85%;
  /* height: 200px; */
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
}
.footer {
  width: 100%;
  background-color: rgb(245, 246, 250);
  height: 100px;
  padding-top: 30px;
  /* margin-top: 10%; */
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: center;
}

.EP_PDF_RIGHT {
  width: 220px;
  display: flex;
  justify-content: space-around;
  height: 67%;
  -ms-flex-pack: distribute;
  justify-content: space-around;
  align-items: end;
}

.EP_PDF_IMG_LEFT {
  display: flex;
  align-items: center;
  /* width: 400px; */
  flex: 1;
  justify-content: space-around;
}

.EP_img {
  width: 59.4px;
  height: 61.97px;
  margin: 0 10px;
}
.leixingcss {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 100px;
  height: 33px;
  border-radius: 4px;
  background-color: #1795ff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  color: #fff;
  margin-left: 15px;
}
.EP_pdf_box {
  margin-top: 10px;
  position: relative;
  width: 100%;
  background: #fff;
  height: 105px;
  border: 1px solid #cecece;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
